package lesson026.demo2;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

@Configuration
public class MainConfig2 {


    @Bean
    public MessageSource messageSource(){
        ReloadableResourceBundleMessageSource  resourceBundleMessageSource = new ReloadableResourceBundleMessageSource();

        resourceBundleMessageSource.setBasename("cn/liontalk/lesson026/message");
        //设置缓存时间1000毫秒
        resourceBundleMessageSource.setCacheMillis(1000);

        return resourceBundleMessageSource;
    }

}
